use super::awk_expr::*;
use super::awk_value::*;

#[derive(Debug, Clone)]
pub enum Statement {
    // Variable assignment: x = 5, $1 = "hello", y += 3
    Assignment {
        target: AssignTarget,
        op: AssignOp,
        value: Expr,
    },
    
    // Increment/decrement: x++, --y, $1++
    Increment(AssignTarget),
    Decrement(AssignTarget),
    
    // Print statement: print, print $1, print x, y, z
    Print(Vec<Expr>),
    
    // Control flow
    If {
        condition: Expr,
        then_stmt: Box<Statement>,
        else_stmt: Option<Box<Statement>>,
    },
    
    While {
        condition: Expr,
        body: Box<Statement>,
    },
    
    For {
        init: Option<Box<Statement>>,
        condition: Option<Expr>,
        update: Option<Box<Statement>>,
        body: Box<Statement>,
    },
    
    // Block statement: { stmt1; stmt2; stmt3 }
    Block(Vec<Statement>),
    
    // Expression as statement (for side effects)
    Expression(Expr),
}

// Assignment targets: variables or field references
#[derive(Debug, Clone)]
pub enum AssignTarget {
    Identifier(String),    // Regular variable: x = 5
    FieldRef(Expr),       // Field reference: $1 = "hello"
}

// Assignment operators
#[derive(Debug, Clone)]
pub enum AssignOp {
    Assign,              // =
    AddAssign,           // +=
    SubAssign,           // -=
    MulAssign,           // *=
    DivAssign,           // /=
    ModAssign,           // %=
}